/*
** Copyright (C) 2010 Calin Radoni
**
** This file is part of CHScanner.
**
** CHScanner is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** CHScanner is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with CHScanner. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "RgnDialog.h"
#include "WorkCfg.h"
#include "afxwin.h"
#include "afxcmn.h"

#include "MCCLabel.h"
#include "MCCCheckBox.h"

#include "WorkDefinitions.h"

#include "DlgScanJob.h"

class DlgScanCfg : public CRgnDialog
{
	DECLARE_DYNAMIC(DlgScanCfg)

protected:
	DlgScanJob dlgJob;

	WorkDefinitions wd;

	HICON iconUp, iconDown;

	void BuildPosValues(void);
	void RefreshList(void);
	bool SetItemProperties(int, WorkCfgElement*);
	bool AddListElement(WorkCfgElement*);

	void Initialize(void);
	void WorkCfgToData(void);
	void WorkCfgFromData(void);

	virtual void ResizeChilds(void);
	virtual bool GetMinimumSize(RECT*);

	WorkCfgElement* GetSelectedElement(void);
	WorkCfgElement* GetElementByPosValue(int);

	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	MCCLabel    staDesc;
	MCCLabel    staComm;
	MCCLabel    staAS;
	MCCLabel    staMSSG;
	MCCLabel    staMSSD;
	MCCLabel    staMSSI;
	MCCLabel    staMWT;
	MCCLabel	staMDT;
	CEdit       editDesc;
	CEdit       editComm;
	CEdit       editAS;
	CEdit       editMSSG;
	CEdit       editMSSD;
	CEdit       editMSSI;
	CEdit       editMWT;
	CEdit		editMDT;
	CComboBox   cmbScanOrder;
	CComboBox   cmbMimic;
	CComboBox   cmbArpCache;
	MCCCheckBox chkShowArpDisc;
	MCCCheckBox chkScanAll;
	CListCtrl   listDet;

	CButton btnUp;
	CButton btnDown;
	CButton btnAdd;
	CButton btnEdit;
	CButton btnDel;
	CButton btnOk;
	CButton btnCancel;
	CButton btnAsh;

	CString vDesc;
	CString vComm;
	CString vAS;
	CString vMssg;
	CString vMssd;
	CString vMssi;
	CString vMwt;
	CString vMdt;
	int     vScanOrder;
	int     vMimic;
	int     vArpCache;
	BOOL    vShowArpDisc;
	BOOL    vScanAll;

	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnBnClickedBtnOk();
	afx_msg void OnBnClickedBtnCancel();
	afx_msg void OnBnClickedBtnAdd();
	afx_msg void OnBnClickedBtnEdit();
	afx_msg void OnBnClickedBtnDel();
	afx_msg void OnBnClickedBtnUp();
	afx_msg void OnBnClickedBtnDw();
	afx_msg void OnBnClickedBtnAsh();
	afx_msg void OnNMDblclkListScandet(NMHDR *pNMHDR, LRESULT *pResult);

	DECLARE_MESSAGE_MAP()

public:
	DlgScanCfg(CWnd* pParent = NULL);   // standard constructor
	virtual ~DlgScanCfg();

	enum { IDD = IDD_DLG_SCANCFG };		// Dialog Data

	MSkin* skinIn;

	WorkCfg wc;
	bool retVal;
};
